package graph 
{
	import data.*;
	
	import flash.utils.Dictionary;
	/**
	 * A node representing a city
	 */
	public class GCNode 
	{
		// List of neighbors that this node has
		private var _neighbors:Vector.<GCNeighborStruct>;
		
		// The id of the city
		private var _cityId:uint;
		
		// Keep track of the min stats needed to reach this city from other cities
		// key: The city at which we are departing from
		// value: The list of stats required to reach this city from the departing city
		private var _statsToReach:Dictionary;
		
		private var _visited:Boolean;
		
		public function GCNode(id:uint) 
		{
			_cityId = id;
			_statsToReach = new Dictionary();
			_neighbors = new Vector.<GCNeighborStruct>();
			_visited = false;
			
			// No stats requirements needed to reach the city you are already in!
			var stats:Vector.<uint> = new Vector.<uint>();
			for (var i:uint = 0; i < GCShipData.NUM_STATS; i++)
			{
				stats.push(0);
			}
			
			_statsToReach[_cityId] = stats;
		}
		
		/**
		 * Add a new neighbor city to this city node
		 * 
		 * @param node
		 * 		Another city node
		 * @param statRequirement
		 * 		The required stats to reach the other city from this one
		 */
		public function addNeighbor(node:GCNode, statRequirement:Vector.<uint>):void
		{
			_neighbors.push(new GCNeighborStruct(node, statRequirement));
		}
		
		public function get cityId():uint
		{
			return _cityId;
		}
		
		public function get statsToReach():Dictionary
		{
			return _statsToReach;
		}
		
		public function get neighbors():Vector.<GCNeighborStruct>
		{
			return _neighbors;
		}
		
		public function get visited():Boolean
		{
			return _visited;
		}
		
		public function set visited(value:Boolean):void
		{
			_visited = value;
		}
	}

}